package com.qf.fmmall.config;/*
 *徐韬
 *2022/1/16
 *11:42
 */

import com.sun.javafx.css.Selector;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

@EnableSwagger2
@Configuration
public class swaggerConfig {


    @Bean
    public Docket getDocker(){


        ApiInfoBuilder apiInfoBuilder = new ApiInfoBuilder();
        //设置接口文档的详细信息
        apiInfoBuilder.title("锋迷商城接口文档说明").description("此文档说明了该项目的后端接口")
                .version("v 1.0.0")
                .contact(new Contact("xt", "2920214639@qq.com", "2920214639@qq.com"));
        ApiInfo apiInfo = apiInfoBuilder.build();
        //创建docket对象交给spring容器管理
        Docket docket = new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo)  //链式调用
        .select()//对控制器进行操作
        .apis(RequestHandlerSelectors.basePackage("com.qf.fmmall.controller"))//指定控制器所在的位置
        .paths(PathSelectors.any())//对所有的接口都生成  也可以对所有的指定的接口进行生成
        .build();

        return docket;


    }
}
